<template name="powerboxRequest">
  {{#let txt="packages.powerbox"}}
  <h4>{{_ (con txt "title")}}</h4>
  {{#if showWebkeyInput}}
    <form id="powerbox-request-form">
      <label>{{_ (con txt "inputToken")}} </label><input name="token" type="text" id="powerbox-request-input"><br>
      <button class="submit">{{_ (con txt "importToken")}}</button>
    </form>
    {{#if webkeyError}}
    <div class="error">{{webkeyError}}</div>
    {{/if}}
  {{else}}
    {{#if error}}
      {{#focusingErrorBox}}
        {{error}}
      {{/focusingErrorBox}}
    {{/if}}

    {{#with selectedProvider}}
      <h4>{{_ (con txt "selected")}}</h4>
      <div class="selected-card">
        <div class="powerbox-card" data-card-id="{{ option._id }}"
             style="background-image: url('{{ iconSrc }}');">
          {{>cardTemplate . }}
        </div>
        {{>configureTemplate . }}
      </div>
    {{else}}
      {{#if Template.subscriptionsReady}}
        <h4>{{_ (con txt "selectOne")}}</h4>
        <div class="search-row">
          <label>
            <span title="Search" class="search-icon"></span>
            <input class="search-bar" type="text" placeholder="search" value="{{ searchText }}">
          </label>
        </div>
        <ul class="candidate-cards">
        {{#each cards}}
          <li class="powerbox-card">
            <button class="card-button" data-card-id="{{ option._id }}"
                    style="background-image: url('{{ iconSrc }}');">
              {{>cardTemplate . }}
            </button>
          </li>
        {{else}}
          <p>{{_ (con txt "noGrain")}}</p>
        {{/each}}
        </ul>
      {{else}}
        <p>{{_ (con txt "loading")}}</p>
      {{/if}}
    {{/with}}
  {{/if}}
  {{/let}}
</template>
